/* 科技感电机控制器样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #e0e0e0;
    overflow: hidden;
}

.main-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
}

.left-panel {
    width: 60%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-right: 2px solid #0f3460;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    overflow-y: auto;
    max-height: 100vh;
}

.right-panel {
    width: 40%;
    background: linear-gradient(135deg, #16213e 0%, #0f0f23 100%);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #0f3460 0%, #533483 100%);
    color: #00d4ff;
    padding: 15px;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
    border: 1px solid #00d4ff;
    flex-shrink: 0;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 0;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    font-weight: 300;
}

.header p {
    font-size: 1em;
    opacity: 0.9;
    color: #b0b0b0;
}

.section {
    background: rgba(15, 52, 96, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #0f3460;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #00d4ff, #ff6b6b, #4ecdc4, #45b7d1);
    background-size: 400% 400%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
}

.section h2 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.info-box {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid #00d4ff;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #00d4ff;
}

.info-box i {
    color: #00d4ff;
    font-size: 16px;
}

.connection-status {
    background: rgba(0, 212, 255, 0.15);
    border: 2px solid #00d4ff;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #00d4ff;
    animation: slideIn 0.4s ease-out;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
    position: relative;
    transition: all 0.3s ease;
}

.connection-status.success {
    background: rgba(76, 175, 80, 0.15);
    border-color: #4caf50;
    color: #4caf50;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.2);
}

.connection-status.error {
    background: rgba(244, 67, 54, 0.15);
    border-color: #f44336;
    color: #f44336;
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.2);
}

.connection-status i {
    font-size: 20px;
}

.connection-status .close-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 5px;
    margin-left: auto;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.connection-status .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.connection-status .close-btn i {
    font-size: 12px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* 电机配置监控样式 */
.motor-config-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #0f3460;
}

.motor-config-section h3 {
    color: #ffa726;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 8px;
}

.motor-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.motor-config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 167, 38, 0.05);
    border: 1px solid rgba(255, 167, 38, 0.2);
    border-radius: 6px;
    font-size: 14px;
}

.motor-config-label {
    color: #b0b0b0;
    font-weight: 300;
}

.motor-config-value {
    color: #ffa726;
    font-weight: 500;
}

/* 电机实时信息样式 */
.motor-realtime-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #0f3460;
}

.motor-realtime-section h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 8px;
}

.motor-realtime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.motor-realtime-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 6px;
    font-size: 14px;
}

.motor-realtime-label {
    color: #b0b0b0;
    font-weight: 300;
}

.motor-realtime-value {
    color: #00d4ff;
    font-weight: 500;
}

.motor-realtime-indicator {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.motor-realtime-indicator.unknown {
    background: rgba(176, 176, 176, 0.2);
    color: #b0b0b0;
}

.motor-realtime-indicator.running {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
}

.motor-realtime-indicator.stopped {
    background: rgba(176, 176, 176, 0.2);
    color: #b0b0b0;
}

.motor-realtime-indicator.fault {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

/* 串口监控样式 */
.serial-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.serial-controls .btn {
    font-size: 12px;
    padding: 6px 12px;
}

.serial-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.serial-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: #00d4ff;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.serial-input input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

.serial-input input::placeholder {
    color: #666;
}

.serial-input .btn {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
}

.monitor-status {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    background: #333;
    color: #ff4444;
    border: 1px solid #ff4444;
}

.monitor-status.connected {
    background: #1a3d1a;
    color: #00ff00;
    border-color: #00ff00;
}

.monitor-status.monitoring {
    background: #1a1a3d;
    color: #00ffff;
    border-color: #00ffff;
}

.serial-content {
    background: #000;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 15px;
    height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 15px;
}

.serial-line {
    margin-bottom: 5px;
    display: flex;
    align-items: flex-start;
}

.serial-time {
    color: #888;
    margin-right: 8px;
    font-weight: bold;
    min-width: 80px;
    font-size: 12px;
}

.serial-text {
    color: #ffffff;
    word-break: break-all;
    flex: 1;
}

.serial-text.success {
    color: #00ff00;
}

.serial-text.error {
    color: #ff4444;
}

.serial-text.warning {
    color: #ffaa00;
}

.serial-text.info {
    color: #00ffff;
}

/* 滚动条样式 */
.serial-content::-webkit-scrollbar {
    width: 8px;
}

.serial-content::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.serial-content::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
}

.serial-content::-webkit-scrollbar-thumb:hover {
    background: #00cccc;
}

.status-item {
    background: rgba(0, 212, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.status-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left 0.5s;
}

.status-item:hover::before {
    left: 100%;
}

.status-item:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.2);
}

.status-label {
    font-size: 0.85em;
    color: #b0b0b0;
    margin-bottom: 5px;
}

.status-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #e0e0e0;
}

.status-connected { color: #4ecdc4; }
.status-disconnected { color: #ff6b6b; }
.status-warning { color: #ffa726; }
.status-running { color: #00d4ff; }
.status-stopped { color: #b0b0b0; }

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.btn {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f3460 0%, #533483 100%);
    color: #e0e0e0;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #0f0f23;
    border-color: #00d4ff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0099cc 0%, #007aa3 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: #0f0f23;
    border-color: #4ecdc4;
}

.btn-success:hover {
    background: linear-gradient(135deg, #44a08d 0%, #3d8b7a 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffd93d 0%, #ff6b6b 100%);
    color: #0f0f23;
    border-color: #ffd93d;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: #e0e0e0;
    border-color: #ff6b6b;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ee5a52 0%, #e53e3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #45b7d1 0%, #96c93d 100%);
    color: #0f0f23;
    border-color: #45b7d1;
}

.btn-info:hover {
    background: linear-gradient(135deg, #96c93d 0%, #7cb342 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(69, 183, 209, 0.4);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #00d4ff;
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    font-size: 0.9em;
    background: rgba(15, 52, 96, 0.3);
    color: #e0e0e0;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
    background: rgba(15, 52, 96, 0.5);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.log-panel {
    height: 50vh;
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.4;
    border-bottom: 2px solid #0f3460;
    flex-shrink: 0;
}

.log-panel h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    padding-bottom: 8px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.log-content {
    height: calc(50vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
}

.log-entry {
    margin-bottom: 6px;
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid transparent;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-size: 0.8em;
}

.log-entry:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateX(3px);
}

.log-info { border-left-color: #00d4ff; }
.log-success { border-left-color: #4ecdc4; }
.log-warning { border-left-color: #ffd93d; }
.log-error { border-left-color: #ff6b6b; }

.log-timestamp {
    color: #b0b0b0;
    font-size: 0.75em;
}

.log-message {
    margin-left: 8px;
}

.monitor-panel {
    height: 50vh;
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Segoe UI', sans-serif;
    flex-shrink: 0;
}

.monitor-panel h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 1px solid rgba(78, 205, 196, 0.3);
    padding-bottom: 8px;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.monitor-content {
    height: calc(50vh - 120px);
    overflow-y: auto;
}

.monitor-item {
    background: rgba(78, 205, 196, 0.1);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid rgba(78, 205, 196, 0.2);
    transition: all 0.3s ease;
}

.monitor-item:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: translateX(3px);
}

.monitor-label {
    font-size: 0.8em;
    color: #b0b0b0;
    margin-bottom: 4px;
}

.monitor-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #4ecdc4;
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-top: 2px solid #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 60%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #0f3460 0%, #533483 100%);
    color: #00d4ff;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 300;
}

.close {
    color: #b0b0b0;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #00d4ff;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 212, 255, 0.3);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-file-input textarea {
    width: 100%;
    height: 250px;
    padding: 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    resize: vertical;
    background: rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    transition: border-color 0.3s ease;
}

.config-file-input textarea:focus {
    outline: none;
    border-color: #00d4ff;
}

.hidden {
    display: none !important;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

@media (max-width: 1200px) {
    .left-panel {
        width: 65%;
    }
    .right-panel {
        width: 35%;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .left-panel,
    .right-panel {
        width: 100%;
        height: 50vh;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .control-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 100%;
    }
    
    .modal-content {
        max-width: 90%;
    }
}
